﻿
namespace ModernChannel.Data.DataContextStorage
{
    public class DataContextFactory
    {
        public static ModernChannelEntities GetDataContext()
        {
            IDataContextStorageContainer dataContextStorageContainer = DataContextStorageFactory.CreateStorageContainer();

            ModernChannelEntities authenticationEntities = dataContextStorageContainer.GetDataContext();

            if (authenticationEntities == null)
            {
                authenticationEntities = new ModernChannelEntities();
                dataContextStorageContainer.Store(authenticationEntities);
            }

            return authenticationEntities;
        }
    }
}
